<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
 
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>	
<%@ page import="org.limp.mine.DateTrimmer"%>
<% 
    String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[])request.getAttribute("result");	
	Label label = (Label)result[1];
	Controller controller = (Controller)result[2];	
	String pageNO = (String)result[3];
	List resultList = (List) result[0];
	
	String wjjsr_name = (String)request.getAttribute("wjjsr_name");
	String wj_name = (String)request.getAttribute("wj_name");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>文件传送列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<jsp:include page="../head.jsp"></jsp:include>
<style>
h1 {
	font-family: Arial, sans-serif;
	font-size: 15px;
	color: #369;
	padding-bottom: 4px;
	border-bottom: 1px solid #999;
}
</style>
<script language="javascript">
  function handleQuery(){
    document.form1.action = context + "/app/wjcs.do?method=list4query";
    document.form1.submit();
  }
  
  function init() {
	if (parent && parent.resizeFrame) {
		parent
				.resizeFrame(document.getElementsByTagName("body")[0].scrollHeight
						+ 50);
	}
  }  
   
  function handleReresh(){
      window.location.href = context + "/app/wjcs.do?method=list4query&pageNO=<%=pageNO%>";
  }
  
  function viewJSR(i, id){
      if($('jsr' + i).style.display == 'block'){
          $('jsr' + i).style.display = 'none';
          $('img' + i).src = context + '/app/wjcs/images/plus.png';
          $('jsr' + i).innerHTML = '&nbsp;数据加载过程中...';
          
          init();
      }else{
          $('jsr' + i).style.display = 'block';
          $('img' + i).src = context + '/app/wjcs/images/minus.png';
          
          var url = context + '/app/wjcs.do?method=queryjsr&id=' + id;
		  Ext.Ajax.request({
				// 请求地址
				url : url,
				scriptTag : true,
				// 成功时回调
				success : function(response, options) {
					var json = response.responseText;
					var o = Ext.util.JSON.decode(json);

					var pendingListTxt = '';

					var idx = 0;

					Ext.each(o.list, function(item) {

					            if(item.WJJSR_TYPE == 'user' && item.WJJS_STATUS == '未接收'){
									pendingListTxt += item.WJJSR_NAME + ' <font color="red">(' + item.WJJS_STATUS +  ')</font><br/>';
								}else if(item.WJJSR_TYPE == 'user' && item.WJJS_STATUS == '已接收'){
									pendingListTxt += item.WJJSR_NAME + ' <font color="blue">(' + item.WJJS_STATUS +  ')</font><br/>';
								}else{
								    pendingListTxt += item.WJJSR_NAME + '<br/>';
								}
								
								idx++;
							});

					$('jsr' + i).innerHTML = pendingListTxt;
					
					init();
				},
				failure : function(response, options) {
					alert('获取信息出现异常!');
				}
			});
      } 
  }
</script>
<script src="<%=context%>/resources/common/js/common.js"></script>
<body onload="inithelper();init();">
<form name="form1" method="post" action="">
<input type="hidden" name="pageNO" value="<%=pageNO%>">
<br/>
<div style="width:100%;"><h1>&nbsp;&nbsp;文件传送列表</h1></div>
<table class="tab4list" border="0" width="95%" cellspacing="0" cellpadding="0" align="center">
  <tr>
   <td colspan="3" align="left" class="td0">
            接收人姓名： <input type="text" class="box3" name="wjjsr_name" value="<%=wjjsr_name%>">
            文件名称： <input type="text" class="box3" name="wj_name" value="<%=wj_name%>">
      <img src="/oa/system/workflow/images/query.png" title="查询" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleQuery();"/>查询      
   </td>
  </tr>
  <tr class="tr0" bgcolor="#A7CADE"> 
    <td class="td1" width="50%">&nbsp;文件名称</td>
    <td class="td1" width="35%" align="center">&nbsp;文件接收人</td>
    <td class="td1" width="20%" align="center">&nbsp;文件发送时间</td>
    
  </tr>
  <% 
    if(resultList!=null&&!resultList.isEmpty()){
    
       for(int i=0;i<resultList.size();i++){
	       Map info = (Map)resultList.get(i);
	       String number = (String)info.get("PAGINATION_NUMBER");
	       
	       String id = (String)info.get("ID");
	       
	       String ANNEX_NAME = info.get("ANNEX_NAME").toString();
	       
	       String WJJSR_NAME = (String)info.get("WJJSR_NAME");
	        
           String SEND_TIME = info.get("SEND_TIME").toString();
           //String WJJS_STATUS = info.get("WJJS_STATUS").toString();
           String fj_id = info.get("XSYSTEM_ANNEX_ID").toString();
           String mytime="";
           //String mytime = DateTrimmer.format2YYYYMMdd(SEND_TIME);
           if(!"".equals(SEND_TIME)){
        	   mytime = DateTrimmer.formatDateForVarchar(SEND_TIME);
        	   
           }
           
          
  %> 
  <tr> 
   
    <td height="27" valign="middle">&nbsp;<a href="javascript:viewAnnex('<%=fj_id%>');"><%=ANNEX_NAME%></a></td>
    <td valign="middle"><div style="padding-top:2px;">&nbsp;<a title="点击查看文件接收人信息" href="javascript:void(0);" class="ititle" onclick="javascript:viewJSR('<%=i %>', '<%=id %>');">
    <img src="<%=context %>/app/wjcs/images/plus.png" id="img<%=i %>" style="cursor:hand;margin-bottom:-4px;"> 查看</a></div>
    <div id="jsr<%=i %>" style="display:none;padding-left:20px;padding-top:2px;">&nbsp;数据加载过程中...</div>
    </td>
    <td valign="middle" align="center">&nbsp;<%=DateTrimmer.getYMDHM_LBL(SEND_TIME)%></td>
    
  </tr>
  <%
        }
     }
  %>
</table> 
<table width="95%" class="tab-noborder" align="center" border="0" cellspacing="0" cellpadding="0">
  <tr>
   <td>
    <%=label.displayLabel()%>
   </td>
   <td align="right">
        <%=label.startLabel()%>
        <%=label.previousLabel()%>
        <%=label.nextLabel()%>
        <%=label.endLabel()%>
        <%=controller.getController().toString()%>
    </td>
  </tr>
</table>  
<%=controller.getControlScript(true)%> 
</form>
</body>
</html>	